﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>来加健康服务网</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <!-- 移动设备支持 -->
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
    <meta content="no-cache" http-equiv="pragma">
    <meta content="0" http-equiv="expires">
    <meta content="telephone=no, address=no" name="format-detection">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <link type="text/css" rel="stylesheet" href="Public/mobile/js/layer/skin/layer.css?1"/>
  	<link href="Public/mobile/css/reset.css?165" rel="stylesheet" type="text/css">
    <link href="Public/mobile/personal/css/explain.css" rel="stylesheet" type="text/css">
  	<link href="Public/mobile/personal/css/new.css" rel="stylesheet" type="text/css">
  	
    <link href="Public/mobile/css/upload.css" rel="stylesheet" type="text/css">
 <!--    <style type="text/css">
        a:hover {
            text-decoration: none;
        }

        .in-cont {
            display: none
        }
    </style> -->
    <script type="text/javascript">
      function onImageError(obj){
        obj.src="Public/home/images/default.gif";
    }
    </script>
</head>
<body>
<div id="wrap">
	<header class="header">
                    <a class="fhbtn" href="member.html"></a>
                    <h2>账户信息</h2>
                    <a  class="fhbtn" href="Index.html"></a>
    </header>
    
    <div id="content">
        <div class="user_ct"><a href="imgfile.html"><img src="" onerror="onImageError(this)"/></a></div>
     
        <form action="" id="edit_form">
			<ul class="user-cylist">
				<li>
					<span>用户名：</span>
					<input style="float:right;height:45px;width:auto;border:0px;margin-right:8px;text-align:right;" type="text" placeholder="Lj19012345678"  name="name" id="m_name">
				</li>

				<li>
					<span>手机号：</span>
					<input style="float:right;height:45px;width:auto;border:0px;margin-right:8px;text-align:right;" type="phpne" placeholder="19012345678" name="phone" id="m_phone">
				</li>

				<li>
					<span>生日：</span>
					<input style="float:right;height:45px;width:auto;border:0px;margin-right:8px;text-align:right;" type="date" placeholder="1999-09-09" name="birthday">
				</li>

				<li>
					<span>性别：</span>
                   	 <a style="float:right;height:45px;width:auto;margin-right:8px;" id="sext">
	                    <span id="btn">女</span>
						<img src="Public/mobile/images/sex_icon.png" style="height:18px;width:auto;" alt="" id="pic" onClick="change_pic()">
                     </a>
					<script>
						function change_pic(){
							var imgObj = document.getElementById("pic");
							var Flag=(imgObj.getAttribute("src",2)=="Public/mobile/images/sex_icon.png")
							imgObj.src=Flag?"Public/mobile/images/sex_icon1.png":"Public/mobile/images/sex_icon.png";
							if ($("#btn").text() == '男' ) {
							   $("#btn").text('女');
							} else {
							   $("#btn").text('男');
							}
							
						}
					</script>
                </li>

                <li>
                	<a href="modify_pwd.html">登陆密码<i>修改</i></a>
                </li>

             	<li>
              		<a href="my_delivery_address.html">收件地址<i>修改</i></a>
              	</li>
			</ul>
        </form>
        
        <div class="h80"></div>
         <a class="common-btn sub-box" href="javascript:void (0)" onclick="Save_member()">保存</a>
       
    </div>
</div>



<script type="text/javascript">
  	// 定义一些常量
	var __public='/Public';
    //访问入口类型，值有：weixin微信,normal普通浏览器
	var __access_type__="normal";
	var __indexUrl__="/";//默认的首页地址,即当返回到顶层时的地址
  var __root__="/";//根目录地址
  var __appId = null;
  var __timestamp = null;
  var __nonceStr = null;
  var __signature = null;
  if(__access_type__ == 'weixin'){
      // 定义一些常量
      __appId = "";              // 必填，公众号的唯一标识
      __timestamp = "";  // 必填，生成签名的时间戳
      __nonceStr = "";           // 必填，生成签名的随机串
      __signature = "";  // 必填，签名，见附录1
  }
</script>
<script>//
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?7b2b4b745cfe9f106de279f1f705dd6c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="Public/mobile/js/layer/layer.js?1"></script>
<script type="text/javascript" src="Public/mobile/js/common.js?5"></script>
 <script type="text/javascript" src="Public/mobile/js/member.js"></script> 	
 <script type="text/javascript">
     $(function(){
         //保存
         $(document).on(eventMap("click"), '#save_member', function () {
             var name=$('#m_name').val();
             if(name==''||name==null){
                 zk_alert_msg('请输入用户名');
                 return false;
             }

             var data=$("#edit_form").serialize();
             $.ajax({
                 type:'post',
                 url:'/Mobile/Member/do_save_member.html',
                 data:data,
                 dataType:'json',
                 success: function (res) {
                     if (res.status == 1) {
                         location.replace(location.href);
                     }
                     else {
                         zk_alert_msg(res.msg);
                     }
                 }
             });
         });

          $(document).on(eventMap("click"), '#save_member', function () {
             var name=$('#m_phone').val();
             var z_name=/^1[34578]\d{9}$/.test(name);
             if(!z_name){
                 zk_alert_msg('请输入正确的手机号');
                 return false;
             }
             
             var data=$("#edit_form").serialize();
             $.ajax({
                 type:'post',
                 url:'/Mobile/Member/do_save_member.html',
                 data:data,
                 dataType:'json',
                 success: function (res) {
                     if (res.status == 1) {
                         location.replace(location.href);
                     }
                     else {
                         zk_alert_msg(res.msg);
                     }
                 }
             });
         });

     })
 </script>
    <script>
        function Save_member()
        {
            var name=$("#m_name").val();
            if(name==''||name==null){
                zk_alert_msg('请输入用户名');
                return false;
            }
            var name=$("#m_phone").val();
            //var z_name=/^1[34578]\d{9}$/.test(name);
            //if(!z_name){
            //    zk_alert_msg('请输入正确的手机号');
            //    return false;
            //}

            var data=$("#edit_form").serialize();
            $.ajax({
                type:'post',
                url:'/Mobile/Member/do_save_member.html',
                data:data,
                dataType:'json',
                success: function (res) {
                    if (res.status == 1) {
                        location.replace(location.href);
                    }
                    else {
                        zk_alert_msg(res.msg);
                    }
                }
            });
             zk_alert_msg('保存成功')
             localtion.href('personal.html');
        }
    </script>

<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            url: '/Api/IsLogin',
            type: 'post',
            dataType: 'json',
            success: function (data) {
                if (data.Code == 1) {
                    $("#nick").html(data.Data.Name);
                    $("#phone").html(data.Data.PhoneNumber);
                    var name = data.Data.TrueName;
                    $("#name").html("*" + name.substring(1));
                    if (data.Data.Gender == true) {
                        $("#sex").html("男");
                    }
                    else { 
                        $("#sex").html("女");
                    }
                }
                else {
                    location.href = '/wap/login.html';
                }
            },
            beforeSend: function (xhr) {
                var storage = window.localStorage;
                var ticket = storage.getItem('token');
                xhr.setRequestHeader("token", ticket);
            },
            error: function () {
               return:false;
            }
        });

    });
</script>

</body>
</html>